<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class TestController extends Controller
{
    public function getFun(){
    	return view("test.form");
    }
    public function postFun1(Request $request){
    	$method = $request->method();
    	$isget = $request -> isMethod("post");
    	$path = $request->path();
    	$url = $request -> url();
    	$url = $request -> ip();
    	$port = $request -> getPort();
    	dd($port);
    }
    public function postFun2(Request $request){
    	//dd($_POST);
    	$name = $request->input("name");
    	$pass = $request->input("pass");
    	$request->input("name","21");
    	//$age = $request->input("name");
    	$is = $request->has("age");
    	$all = $request -> all();
    	$bufen = $request -> only(["name","pass","nickname"]);
    	$quchu = $request -> except(["_token","name"]);
    	$head = $request -> header('Cache-Control');
    	dd($head);
    }
     public function postFun3(Request $request){
    	// if(!$request->has("pass")){
    	// //	echo "密码不存在";
    	// 	return back()->withInput();
    	// }
    	 //$request -> flash();
     	//$request -> flashOnly(["name","pass"]);
     	$request -> flashExcept(['name']);
     	dd($request->session()->all());
    	 return back();
    }
    public function postFun4(Request $request){
    	 if($request -> hasFile("pic")){
    	 	$picname = $request->file('pic')->getClientOriginalName();
    	 
    	 	$request -> file("pic") -> move("./uploads",$picname);
    	 }
    }
   
}
